﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BrewTarget.Models
{
    public class Mash : BeerBase
    {
        public string Name { get; set; }
        public double GrainTempInCelsius { get; set; }
        public string Notes { get; set; }
        public double TunTempInCelsius { get; set; }
        public double SpargeTempInCelsius { get; set; }
        public double PH { get; set; }
        public double TunWeightInKilograms { get; set; }
        public double TunSpecificHeat_CalGC { get; set; }
        public bool EquipAdjust { get; set; }


        public Collection<MashStep> MashSteps { get; set; }
        
        public Mash()
        {
            MashSteps = new Collection<MashStep>();
        }

        public double TotalMashWaterInLiters
        {
            get
            {
                double totalWater = 0;

                foreach(MashStep aStep in MashSteps)
                {
                    if (aStep.Type == Constants.MashStepType.Infusion)
                        totalWater += aStep.InfusionAmountInLiters;
                }

                return totalWater;
            }
        }

        public TimeSpan TotalTime
        {
            get
            {
                TimeSpan tempTime = TimeSpan.Zero;

                foreach (MashStep aStep in MashSteps)
                    tempTime += aStep.StepTime;

                return tempTime;
            }
        }

    }
}
